<div class="wide form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'appointments-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="column">
		<?php echo $form->labelEx($model,'patientId'); ?>

		<?php echo $form->dropDownList($model, 'patientId', CHtml::listData(
				Patients::model()->findAll(), 'patientId', 'lastName'),
				array('prompt' => 'Select a Patient')
		); ?>	
		<?php echo $form->error($model,'patientId'); ?>
	</div>
	
	<div class="column">
		<?php echo $form->labelEx($model,'physicianId'); ?>
		<?php echo $form->dropDownList($model, 'physicianId', CHtml::listData(
				Staffs::model()->findAll(), 'staffId', 'lastName'),
				array('prompt' => 'Select a Physician')
		); ?>		
		<?php echo $form->error($model,'physicianId'); ?>
	</div>	
	
	<div class="column">
		<?php echo $form->labelEx($model,'hospitalId'); ?>

		<?php echo $form->dropDownList($model, 'hospitalId', CHtml::listData(
				Hospital::model()->findAll(), 'hospitalId', 'title'),
				array('prompt' => 'Select a Hospital')
		); ?>

		<?php echo $form->error($model,'hospitalId'); ?>
	</div>	
	
	<div class="column">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->dropDownList($model, 'status',  
              array('1' => 'Open', '2' => 'Confirmed', '3' => 'Completed', '4' => 'Cancelled'),
              array('empty' => 'Select a Status')); ?>	
        <?php echo $form->error($model,'status'); ?>
	</div>	

	<div class="column">
		<?php echo $form->labelEx($model,'apointmentDateTime'); ?>

		<?php 
			$this->widget('zii.widgets.jui.CJuiDatePicker', array(
				'model'=>$model,
				'attribute'=>'apointmentDateTime',
				'value'=>$model->apointmentDateTime,
				'options'=>array(
				'dateFormat'=>'yy-mm-dd H:mm',
				'showAnim'=> 'fold',
				'autoSize'=>true,
				'showButtonPanel'=>true,
				'defaultDate'=>$model->apointmentDateTime,
				),
			'htmlOptions'=>array(
			'style'=>'width:100px;'
			),
		));
		?>

		<?php echo $form->error($model,'apointmentDateTime'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'cancelReason'); ?>
		<?php echo $form->textArea($model,'cancelReason',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'cancelReason'); ?>
	</div>

	<div class="rowhidden">
		<?php echo $form->labelEx($model,'createdBy'); ?>
		<?php echo $form->textField($model,'createdBy',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'createdBy'); ?>
	</div>

	<div class="rowhidden">
		<?php echo $form->labelEx($model,'createdTime'); ?>
		<?php echo $form->textField($model,'createdTime'); ?>
		<?php echo $form->error($model,'createdTime'); ?>
	</div>

	<div class="rowhidden">
		<?php echo $form->labelEx($model,'updatedBy'); ?>
		<?php echo $form->textField($model,'updatedBy',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'updatedBy'); ?>
	</div>

	<div class="rowhidden">
		<?php echo $form->labelEx($model,'updatedTime'); ?>
		<?php echo $form->textField($model,'updatedTime'); ?>
		<?php echo $form->error($model,'updatedTime'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->